package felix.things.router;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;

/**
 * @author Felix
 * @date 2019/11/9
 */
@Slf4j
@SpringBootApplication
public class OpcUARouterApplication {

    public static void main(String[] args) {
        try {
            SpringApplication app = new SpringApplication(OpcUARouterApplication.class);
            Environment env = app.run(args).getEnvironment();
            log(env);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            System.exit(1);
        }
    }

    /**
     * 格式化运行成功后输出项目地址
     *
     * @param env
     */
    private static void log(Environment env) {
        String name = env.getProperty("spring.application.name");
        log.info(
                "\n----------------------------------------------------------\n"
                        + "\tApplication '{}' is running!\n"
                        + "----------------------------------------------------------",
                name);
    }

}
